package com.yuedao.sender.model1;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

/**
 * Created with IntelliJ IDEA
 * User: z
 * DATE: 2018/10/29
 * TIME: 2018-10-29
 * Description:
 */
@Entity
@Table(name = "ydx_ads")
public class AdsEntity {
    private Integer id;
    private String name;
    private String imageUrl;
    private String imageAlt;
    private String linkUrl;
    private Timestamp startDate;
    private Timestamp endDate;
    private Integer publish;
    private String position;
    private String appName;
    private Integer adType;
    private String pageId;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Basic
    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "image_url")
    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    @Basic
    @Column(name = "image_alt")
    public String getImageAlt() {
        return imageAlt;
    }

    public void setImageAlt(String imageAlt) {
        this.imageAlt = imageAlt;
    }

    @Basic
    @Column(name = "link_url")
    public String getLinkUrl() {
        return linkUrl;
    }

    public void setLinkUrl(String linkUrl) {
        this.linkUrl = linkUrl;
    }

    @Basic
    @Column(name = "start_date")
    public Timestamp getStartDate() {
        return startDate;
    }

    public void setStartDate(Timestamp startDate) {
        this.startDate = startDate;
    }

    @Basic
    @Column(name = "end_date")
    public Timestamp getEndDate() {
        return endDate;
    }

    public void setEndDate(Timestamp endDate) {
        this.endDate = endDate;
    }

    @Basic
    @Column(name = "publish")
    public Integer getPublish() {
        return publish;
    }

    public void setPublish(Integer publish) {
        this.publish = publish;
    }

    @Basic
    @Column(name = "position")
    public String getPosition() {
        return position;
    }

    public void setPosition(String position) {
        this.position = position;
    }

    @Basic
    @Column(name = "app_name")
    public String getAppName() {
        return appName;
    }

    public void setAppName(String appName) {
        this.appName = appName;
    }

    @Basic
    @Column(name = "ad_type")
    public Integer getAdType() {
        return adType;
    }

    public void setAdType(Integer adType) {
        this.adType = adType;
    }

    @Basic
    @Column(name = "page_id")
    public String getPageId() {
        return pageId;
    }

    public void setPageId(String pageId) {
        this.pageId = pageId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        AdsEntity adsEntity = (AdsEntity) o;
        return id == adsEntity.id &&
                publish == adsEntity.publish &&
                Objects.equals(name, adsEntity.name) &&
                Objects.equals(imageUrl, adsEntity.imageUrl) &&
                Objects.equals(imageAlt, adsEntity.imageAlt) &&
                Objects.equals(linkUrl, adsEntity.linkUrl) &&
                Objects.equals(startDate, adsEntity.startDate) &&
                Objects.equals(endDate, adsEntity.endDate) &&
                Objects.equals(position, adsEntity.position) &&
                Objects.equals(appName, adsEntity.appName) &&
                Objects.equals(adType, adsEntity.adType) &&
                Objects.equals(pageId, adsEntity.pageId);
    }

    @Override
    public int hashCode() {

        return Objects.hash(id, name, imageUrl, imageAlt, linkUrl, startDate, endDate, publish, position, appName, adType, pageId);
    }
}
